﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Opdracht_1
{
    public partial class Form1 : Form
    {
        Button[,] buttons = new Button[9,9];

        public Form1()
        {
            InitializeComponent();
        }

        void Mymethod(object sender, EventArgs e)
        {
            int possibilities = 0;
            Button b = (Button)sender;
            Form numberchoice = new NumberChoice(possibilities);
            numberchoice.ShowDialog();
            b.Text = numberchoice.Tag.ToString();
        }

        private void button82_Click(object sender, EventArgs e)
        {
            
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            int cur_row = 0;
            int cur_column = 0;
            while(cur_row <= 8)
            {
                int extrahorzwidth = 0;
                int extravertwidth = 0;
                extrahorzwidth = (cur_column / 3) * 2;
                extravertwidth = (cur_row / 3) * 2;
                extrahorzwidth += 1;
                Button button = new Button();
                button.Location = new Point(14, 14);
                button.Width = 19;
                button.Height = 19;
                button.Left = button.Left + 1 + extrahorzwidth + (20 * cur_column);
                button.Top = button.Top + extravertwidth + (20 * cur_row);
                button.Text = "";
                buttons[cur_row, cur_column] = button;
                this.Controls.Add(button);
                if (cur_column == 8)
                {
                    cur_column = 0;
                    cur_row++;
                }
                else
                {
                    cur_column++;
                }
            }
        }
    }  
}